<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Sass::Engine</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Sass::Engine</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/plugins/haml/lib/sass/engine_rb.html">
                vendor/plugins/haml/lib/sass/engine.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
This is the class where all the parsing and processing of the <a
href="../Sass.html">Sass</a> template is done. It can be directly used by
the user by creating a <a href="Engine.html#M000055">new</a> instance and
calling <tt><a href="Engine.html#M000056">render</a></tt> to <a
href="Engine.html#M000056">render</a> the template. For example:
</p>
<pre>
  template = File.load('stylesheets/sassy.sass')
  sass_engine = Sass::Engine.new(template)
  output = sass_engine.render
  puts output
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000058">constants</a>&nbsp;&nbsp;
      <a href="#M000055">new</a>&nbsp;&nbsp;
      <a href="#M000056">render</a>&nbsp;&nbsp;
      <a href="#M000059">render_to_tree</a>&nbsp;&nbsp;
      <a href="#M000057">to_css</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ATTRIBUTE_CHAR</td>
          <td>=</td>
          <td class="context-item-value">?:</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The character that begins a <a href="CSS.html">CSS</a> attribute.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">SCRIPT_CHAR</td>
          <td>=</td>
          <td class="context-item-value">?=</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The character that designates that an attribute should be assigned to the
result of constant arithmetic.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">COMMENT_CHAR</td>
          <td>=</td>
          <td class="context-item-value">?/</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The character that designates the beginning of a comment, either <a
href="../Sass.html">Sass</a> or <a href="CSS.html">CSS</a>.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">SASS_COMMENT_CHAR</td>
          <td>=</td>
          <td class="context-item-value">?/</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The character that follows the general COMMENT_CHAR and designates a <a
href="../Sass.html">Sass</a> comment, which is not output as a <a
href="CSS.html">CSS</a> comment.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">CSS_COMMENT_CHAR</td>
          <td>=</td>
          <td class="context-item-value">?*</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The character that follows the general COMMENT_CHAR and designates a <a
href="CSS.html">CSS</a> comment, which is embedded in the <a
href="CSS.html">CSS</a> document.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DIRECTIVE_CHAR</td>
          <td>=</td>
          <td class="context-item-value">?@</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The character used to denote a compiler directive.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ATTRIBUTE</td>
          <td>=</td>
          <td class="context-item-value">/^:([^\s=:]+)\s*(=?)(?:\s+|$)(.*)/</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The regex that matches and extracts data from attributes of the form
<tt>:name attr</tt>.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ATTRIBUTE_ALTERNATE_MATCHER</td>
          <td>=</td>
          <td class="context-item-value">/^[^\s:]+\s*[=:](\s|$)/</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The regex that matches attributes of the form <tt>name: attr</tt>.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ATTRIBUTE_ALTERNATE</td>
          <td>=</td>
          <td class="context-item-value">/^([^\s=:]+)(\s*=|:)(?:\s+|$)(.*)/</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
The regex that matches and extracts data from attributes of the form
<tt>name: attr</tt>.

</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000055" class="method-detail">
        <a name="M000055"></a>

        <div class="method-heading">
          <a href="#M000055" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(template, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a <a href="Engine.html#M000055">new</a> instace of <a
href="Engine.html">Sass::Engine</a> that will compile the given template
string when <tt><a href="Engine.html#M000056">render</a></tt> is called.
See README for available options.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000055-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/sass/engine.rb, line 65</span>
65:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">template</span>, <span class="ruby-identifier">options</span>={})
66:       <span class="ruby-ivar">@options</span> = {
67:         <span class="ruby-identifier">:style</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:nested</span>,
68:         <span class="ruby-identifier">:load_paths</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'.'</span>]
69:       }.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">options</span>
70:       <span class="ruby-ivar">@template</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\n\r|\n/</span>)
71:       <span class="ruby-ivar">@lines</span> = []
72:       <span class="ruby-ivar">@constants</span> = {}
73:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000056" class="method-detail">
        <a name="M000056"></a>

        <div class="method-heading">
          <a href="#M000056" class="method-signature">
          <span class="method-name">render</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Processes the template and returns the result as a string.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000056-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/sass/engine.rb, line 76</span>
76:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
77:       <span class="ruby-keyword kw">begin</span>
78:         <span class="ruby-identifier">render_to_tree</span>.<span class="ruby-identifier">to_s</span>
79:       <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SyntaxError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">err</span>
80:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">err</span>.<span class="ruby-identifier">sass_filename</span>
81:           <span class="ruby-identifier">err</span>.<span class="ruby-identifier">add_backtrace_entry</span>(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:filename</span>])
82:         <span class="ruby-keyword kw">end</span>
83:         <span class="ruby-identifier">raise</span> <span class="ruby-identifier">err</span>
84:       <span class="ruby-keyword kw">end</span>
85:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000057" class="method-detail">
        <a name="M000057"></a>

        <div class="method-heading">
          <span class="method-name">to_css</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Engine.html#M000056">render</a>
</p>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000058" class="method-detail">
        <a name="M000058"></a>

        <div class="method-heading">
          <a href="#M000058" class="method-signature">
          <span class="method-name">constants</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000058-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/sass/engine.rb, line 91</span>
91:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constants</span>
92:       <span class="ruby-ivar">@constants</span>
93:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000059" class="method-detail">
        <a name="M000059"></a>

        <div class="method-heading">
          <a href="#M000059" class="method-signature">
          <span class="method-name">render_to_tree</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000059-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/sass/engine.rb, line 95</span>
 95:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_to_tree</span>
 96:       <span class="ruby-identifier">split_lines</span>
 97: 
 98:       <span class="ruby-identifier">root</span> = <span class="ruby-constant">Tree</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:style</span>])
 99:       <span class="ruby-identifier">index</span> = <span class="ruby-value">0</span>
100:       <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@lines</span>[<span class="ruby-identifier">index</span>]
101:         <span class="ruby-identifier">child</span>, <span class="ruby-identifier">index</span> = <span class="ruby-identifier">build_tree</span>(<span class="ruby-identifier">index</span>)
102: 
103:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Tree</span><span class="ruby-operator">::</span><span class="ruby-constant">Node</span>
104:           <span class="ruby-identifier">child</span>.<span class="ruby-identifier">line</span> = <span class="ruby-identifier">index</span>
105:           <span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">child</span>
106:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
107:           <span class="ruby-identifier">child</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
108:             <span class="ruby-identifier">root</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">c</span>
109:           <span class="ruby-keyword kw">end</span>
110:         <span class="ruby-keyword kw">end</span>
111:       <span class="ruby-keyword kw">end</span>
112:       <span class="ruby-ivar">@line</span> = <span class="ruby-keyword kw">nil</span>
113: 
114:       <span class="ruby-identifier">root</span>
115:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>